﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SpeakupUI2
{
    public partial class FilterPanel : UserControl
    {
        public FilterPanel()
        {
            InitializeComponent();
            UseManualFilter = false;
        }

        public static readonly DependencyProperty UseManualFilterProperty;
        public static readonly DependencyProperty HighlightClubProperty;
        public static readonly DependencyProperty HighlightGroupProperty;
        public static readonly DependencyProperty HighlightGrammarProperty;
        public static readonly DependencyProperty HighlightReadingProperty;
        public static readonly DependencyProperty HighlightWritingProperty;
        public static readonly DependencyProperty HighlightConversationProperty;

        static FilterPanel()
        {
            string[] propertyNames = 
            { 
              "UseManualFilter",
              "HighlightClub",
              "HighlightGroup",
              "HighlightGrammar",
              "HighlightReading",
              "HighlightWriting",
              "HighlightConversation"
            };

            DependencyProperty[] properties = new DependencyProperty[propertyNames.Length];

            for (int i = 0; i < propertyNames.Length; i++)
            {
                FrameworkPropertyMetadata metadata = new FrameworkPropertyMetadata();
                metadata.DefaultValue = true;

                properties[i] = DependencyProperty.Register(propertyNames[i],
                                                            typeof(bool),
                                                            typeof(FilterPanel),
                                                            metadata);
            }

            UseManualFilterProperty  = properties[0];
            HighlightClubProperty    = properties[1];
            HighlightGroupProperty   = properties[2];
            HighlightGrammarProperty = properties[3];
            HighlightReadingProperty = properties[4];
            HighlightWritingProperty = properties[5];
            HighlightConversationProperty = properties[6];
        }

        public bool UseManualFilter
        {
            get
            {
                return (bool)GetValue(UseManualFilterProperty);
            }
            set
            {
                SetValue(UseManualFilterProperty, value);
            }
        }

        public bool HighlightClub
        {
            get
            {
                return (bool)GetValue(HighlightClubProperty);
            }
            set
            {
                SetValue(HighlightClubProperty, value);
            }
        }

        public bool HighlightGroup
        {
            get
            {
                return (bool)GetValue(HighlightGroupProperty);
            }
            set
            {
                SetValue(HighlightGroupProperty, value);
            }
        }

        public bool HighlightGrammar
        {
            get
            {
                return (bool)GetValue(HighlightGrammarProperty);
            }
            set
            {
                SetValue(HighlightGrammarProperty, value);
            }
        }

        public bool HighlightReading
        {
            get
            {
                return (bool)GetValue(HighlightReadingProperty);
            }
            set
            {
                SetValue(HighlightReadingProperty, value);
            }
        }

        public bool HighlightWriting
        {
            get
            {
                return (bool)GetValue(HighlightWritingProperty);
            }
            set
            {
                SetValue(HighlightWritingProperty, value);
            }
        }

        public bool HighlightConversation
        {
            get
            {
                return (bool)GetValue(HighlightConversationProperty);
            }
            set
            {
                SetValue(HighlightConversationProperty, value);
            }
        }

        private void UseManualFilterCheckbox_Checked(object sender, RoutedEventArgs e)
        {
            Expander.IsExpanded = true;            
        }

    }
}
